﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace FizzBuzz
{
    class NonSerializedClass
    {
        
    }

    // 3 things in serialization: Serialization, Stream and Formatting
    // XML Serialization: System.Xml.Serialization used to interact with other platforms

    [Serializable]
    class SerializedClass : IDeserializationCallback
    {
        [NonSerialized]
        private NonSerializedClass obj;

        // notification for deserialization
        // to initialize any non-serializable properties
        public void OnDeserialization(object sender)
        {
            throw new NotImplementedException();
        }
    }

    [Serializable]
    class CustomSerialization : ISerializable
    {
        private string name;
        private int age;

        // constructor used for custom deserialization, should be protected to not available
        // to external clients
        protected CustomSerialization(SerializationInfo info, StreamingContext context)
        {
            name = info.GetString("name");
            age = info.GetInt32("age");
        }

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("name", name);
            info.AddValue("age", age);
        }
    }

    class SerializationClient
    {
        public void Run()
        {
            
        }
    }
}
